﻿using System;
using System.Collections.Generic;

namespace Hetymine.Executioner.Data {
    public abstract class BaseConfiguratorList : IConfiguratorList {
        public BaseConfiguratorList() {
            this.Items = new List<IConfiguratorItem>();
            this.CanAddItem = false;
            this.CanRemoveItem = false;
        }
        #region IConfiguratorList
        public abstract IConfiguratorItem InitializeItem();

        public IList<IConfiguratorItem> Items { get; protected set; }

        public event EventHandler ListChanged;
        protected virtual void OnListChanged(EventArgs e) {
            if (this.ListChanged != null) {
                this.ListChanged(this, e);
            }
        }

        public bool CanAddItem { get; protected set; }
        public bool CanRemoveItem { get; protected set; }

        public object ListItemContent(IConfiguratorItem item) {
            return item.Name;
        }

        public int SelectedIndex { get; set; }

        public virtual string ItemName { get { return string.Empty; } }
        public virtual string ListGroupBoxName { get { return string.Empty; } }
        public virtual string EditGroupBoxName { get { return string.Empty; } }
        #endregion 
    }
}
